Originally written April 30th, 2020

Setup:

Options

knitr::opts_chunk$set(tidy = TRUE, fig.width=10, fig.height=8) 

Establishe here()

here::here()
## [1] "/Users/CPR/Academic_2019/Male_reproductive_epigenetics"

General Packages - messages hidden

library(tidyverse)  # loads ggplot, tidyr, readr, dplyr, purrr, forcats, tibble, stringr
library(haven)  # Used to load different datatypes, like .DTA or .dat
library(readr)  # Also used to read different data types
library(sjlabelled)  # as_factor, as_character
library(here)
library(knitr)
library(kableExtra)

Bioconductor packages - messages hidden

library(limma)
library(Biobase)

Load DNAm Data

Select men with data

men_w_eage <- read_csv(here::here("Data/Other", "men_w_eage.csv")) %>% mutate(uncchdid = as_character(uncchdid))
## Parsed with column specification:
## cols(
##   uncchdid = col_double(),
##   icsex = col_character(),
##   blood.draw.date = col_date(format = "")
## )

Get Mvals

mvals <- data.table::fread(file = here::here("Data/DNAm", "mvals_cebu_final_Xincl.csv"), 
    select = c("V1", men_w_eage$uncchdid, "20727_R2"))
## Warning in data.table::fread(file = here::here("Data/DNAm",
## "mvals_cebu_final_Xincl.csv"), : Column name '20727' not found in column name
## header (case sensitive), skipping.
mvals <- mvals %>% column_to_rownames("V1")

Don’t worry bout the error - since 20727 is a replicate, the name doesn’t match. I add it manually.

Filter to 5% variable for MEN

# Loads the function for beta2m and m2beta
source(here::here("Code/EWAS", "EWAS_functions.R"))

# Originally used to calculate 5 percent variable. But loads as names_var_probes
# below.  source(here('Code/functions', 'b-val_filter_5percent.R'))

Five Percent probes for men only: 142,777 rows

names_var_probes <- read_csv(here::here("Data/DNAm", "names_var_probes_menonly_xyincl.csv"))
## Parsed with column specification:
## cols(
##   probe = col_character()
## )

EWAS

T Phenotype EWAS

source(here::here("/Code/EWAS", "t_phenotype_ewas.R"))
## 
## Attaching package: 'lubridate'
## The following object is masked from 'package:here':
## 
##     here
## The following object is masked from 'package:base':
## 
##     date
## Parsed with column specification:
## cols(
##   uncchdid_w_DNAm = col_character()
## )
## Warning: Missing column names filled in: 'X1' [1]
## Parsed with column specification:
## cols(
##   X1 = col_double(),
##   uncchdid = col_double(),
##   icsex = col_character(),
##   dayblood = col_double(),
##   monthblood = col_double(),
##   yearblood = col_double(),
##   blood.draw.date = col_date(format = "")
## )
## Warning: Column `uncchdid` has different attributes on LHS and RHS of join
## Warning: Column `uncchdid` has different attributes on LHS and RHS of join
## Parsed with column specification:
## cols(
##   uncchdid = col_double(),
##   basebrgy = col_double(),
##   basewman = col_double(),
##   ic_dob = col_date(format = ""),
##   smoke = col_double(),
##   drink = col_double(),
##   age_blood05 = col_double(),
##   icpc1 = col_double(),
##   icpc2 = col_double(),
##   icpc3 = col_double(),
##   icpc4 = col_double(),
##   icpc5 = col_double(),
##   icpc6 = col_double(),
##   icpc7 = col_double(),
##   icpc8 = col_double(),
##   icpc9 = col_double(),
##   icpc10 = col_double(),
##   bmi = col_double(),
##   SEAsum_83_05 = col_double()
## )
amt_summary
(Intercept) amt05 age_saliva smoke drink amtime05 icpc1 icpc2 icpc3 bmi SEAsum_83_05
Down 404 0 0 0 7 0 2 1 0 1 0
NotSig 136950 142777 142777 142777 142769 142777 142769 142776 142777 142775 142777
Up 5423 0 0 0 1 0 6 0 0 1 0
pmt_summary
(Intercept) pmt05 age_saliva smoke drink pmtime05 icpc1 icpc2 icpc3 bmi SEAsum_83_05
Down 490 0 0 0 9 0 2 0 0 0 0
NotSig 134752 142777 142777 142777 142765 142777 142769 142777 142777 142777 142777
Up 7535 0 0 0 3 0 6 0 0 0 0
father_summary
(Intercept) fath05c age_blood05 smoke drink icpc1 icpc2 icpc3 bmi SEAsum_83_05
Down 492 0 0 0 8 2 0 0 0 0
NotSig 134770 142777 142777 142777 142767 142771 142777 142777 142777 142776
Up 7515 0 0 0 2 4 0 0 0 1
hhkids_summary
(Intercept) hholdkids05 smoke drink age_blood05 icpc1 icpc2 icpc3 bmi SEAsum_83_05
Down 509 0 0 8 0 2 0 0 0 0
NotSig 134548 142777 142777 142767 142777 142771 142777 142777 142777 142776
Up 7720 0 0 2 0 4 0 0 0 1
icpcfat_summary
(Intercept) icpcfat05 age_blood05 smoke drink icpc1 icpc2 icpc3 bmi SEAsum_83_05
Down 466 0 0 0 9 1 0 0 1 0
NotSig 134218 142777 142777 142777 142766 142771 142777 142777 142776 142777
Up 8093 0 0 0 2 5 0 0 0 0
rgrip_summary
(Intercept) rightgrip_mean age_blood05 smoke drink icpc1 icpc2 icpc3 bmi SEAsum_83_05
Down 515 0 0 0 7 2 0 0 0 0
NotSig 134695 142777 142777 142777 142768 142765 142777 142777 142777 142776
Up 7567 0 0 0 2 10 0 0 0 1
blood_t_summary
(Intercept) log_blood_t age_blood05 smoke drink icpc1 icpc2 icpc3 bmi SEAsum_83_05
Down 515 5 0 0 7 2 0 0 0 0
NotSig 134988 142759 142777 142777 142768 142764 142777 142777 142777 142776
Up 7274 13 0 0 2 11 0 0 0 1

Reproductive Effort EWAS

source(here::here("/Code/EWAS", "repro_phenotype_ewas.R"))
## Parsed with column specification:
## cols(
##   uncchdid_w_DNAm = col_character()
## )
## Warning: Missing column names filled in: 'X1' [1]
## Parsed with column specification:
## cols(
##   X1 = col_double(),
##   uncchdid = col_double(),
##   icsex = col_character(),
##   dayblood = col_double(),
##   monthblood = col_double(),
##   yearblood = col_double(),
##   blood.draw.date = col_date(format = "")
## )
## Parsed with column specification:
## cols(
##   uncchdid = col_double(),
##   basebrgy = col_double(),
##   basewman = col_double(),
##   ic_dob = col_date(format = ""),
##   smoke = col_double(),
##   drink = col_double(),
##   age_blood05 = col_double(),
##   icpc1 = col_double(),
##   icpc2 = col_double(),
##   icpc3 = col_double(),
##   icpc4 = col_double(),
##   icpc5 = col_double(),
##   icpc6 = col_double(),
##   icpc7 = col_double(),
##   icpc8 = col_double(),
##   icpc9 = col_double(),
##   icpc10 = col_double(),
##   bmi = col_double(),
##   SEAsum_83_05 = col_double()
## )
romantic_summary
(Intercept) romantic age_blood05 smoke drink icpc1 icpc2 icpc3 bmi SEAsum_83_05
Down 695 0 0 0 1 2 0 0 0 0
NotSig 132313 142777 142777 142777 142775 142766 142777 142777 142777 142774
Up 9769 0 0 0 1 9 0 0 0 3
sexinter_summary
(Intercept) sexinter age_blood05 smoke drink icpc1 icpc2 icpc3 bmi SEAsum_83_05
Down 657 0 0 0 13 2 0 0 0 0
NotSig 132553 142777 142777 142777 142760 142767 142777 142777 142777 142776
Up 9567 0 0 0 4 8 0 0 0 1
presrela_summary
(Intercept) presrela age_blood05 smoke drink icpc1 icpc2 icpc3 bmi SEAsum_83_05
Down 695 0 0 0 8 2 1 0 0 0
NotSig 132267 142777 142777 142777 142765 142767 142776 142777 142777 142776
Up 9815 0 0 0 4 8 0 0 0 1
numbsex_summary
(Intercept) log(numbsex + 1) age_blood05 smoke drink icpc1 icpc2 icpc3 bmi SEAsum_83_05
Down 645 0 0 0 15 1 0 0 0 0
NotSig 133144 142777 142777 142777 142758 142770 142777 142777 142777 142776
Up 8988 0 0 0 4 6 0 0 0 1
new_numbpreg_summary
(Intercept) new_numbpreg age_blood05 smoke drink icpc1 icpc2 icpc3 bmi SEAsum_83_05
Down 698 1 0 0 12 2 0 0 0 0
NotSig 132292 142769 142777 142777 142759 142770 142777 142777 142777 142775
Up 9787 7 0 0 6 5 0 0 0 2

Anthropometric EWAS

source(here::here("/Code/EWAS", "anthro_phenotype_ewas.R"))
## Parsed with column specification:
## cols(
##   uncchdid_w_DNAm = col_character()
## )
## Warning: Missing column names filled in: 'X1' [1]
## Parsed with column specification:
## cols(
##   X1 = col_double(),
##   uncchdid = col_double(),
##   icsex = col_character(),
##   dayblood = col_double(),
##   monthblood = col_double(),
##   yearblood = col_double(),
##   blood.draw.date = col_date(format = "")
## )
## Warning: Column `uncchdid` has different attributes on LHS and RHS of join
## Parsed with column specification:
## cols(
##   uncchdid_w_DNAm = col_character()
## )
## Warning: Missing column names filled in: 'X1' [1]
## Parsed with column specification:
## cols(
##   X1 = col_double(),
##   uncchdid = col_double(),
##   icsex = col_character(),
##   dayblood = col_double(),
##   monthblood = col_double(),
##   yearblood = col_double(),
##   blood.draw.date = col_date(format = "")
## )
## Warning: Column `uncchdid` has different attributes on LHS and RHS of join
## Warning: attributes are not identical across measure variables;
## they will be dropped
## Parsed with column specification:
## cols(
##   uncchdid = col_double(),
##   basebrgy = col_double(),
##   basewman = col_double(),
##   ic_dob = col_date(format = ""),
##   smoke = col_double(),
##   drink = col_double(),
##   age_blood05 = col_double(),
##   icpc1 = col_double(),
##   icpc2 = col_double(),
##   icpc3 = col_double(),
##   icpc4 = col_double(),
##   icpc5 = col_double(),
##   icpc6 = col_double(),
##   icpc7 = col_double(),
##   icpc8 = col_double(),
##   icpc9 = col_double(),
##   icpc10 = col_double(),
##   bmi = col_double(),
##   SEAsum_83_05 = col_double()
## )
## Warning: Column `uncchdid` has different attributes on LHS and RHS of join
height_summary
(Intercept) height age_blood05 smoke drink icpc1 icpc2 icpc3 SEAsum_83_05
Down 539 0 0 0 9 2 0 0 0
NotSig 135449 142777 142777 142777 142763 142767 142777 142777 142777
Up 6789 0 0 0 5 8 0 0 0
bmi_summary
(Intercept) bmi age_blood05 smoke drink icpc1 icpc2 icpc3 SEAsum_83_05
Down 673 0 0 0 8 2 0 0 0
NotSig 132250 142777 142777 142777 142765 142767 142777 142777 142776
Up 9854 0 0 0 4 8 0 0 1
arm_musc_area_summary
(Intercept) arm_musc_area age_blood05 smoke drink icpc1 icpc2 icpc3 SEAsum_83_05
Down 687 0 0 0 11 2 0 0 0
NotSig 131906 142777 142777 142777 142762 142767 142777 142777 142776
Up 10184 0 0 0 4 8 0 0 1
fatfree_mass_summary
(Intercept) fatfree_mass age_blood05 smoke drink icpc1 icpc2 icpc3 SEAsum_83_05
Down 619 0 0 0 8 2 0 0 0
NotSig 132115 142777 142777 142777 142765 142767 142777 142777 142777
Up 10043 0 0 0 4 8 0 0 0
bfperc_summary
(Intercept) bfperc age_blood05 smoke drink icpc1 icpc2 icpc3 SEAsum_83_05
Down 557 0 0 0 8 2 0 0 0
NotSig 133101 142777 142777 142777 142765 142767 142777 142777 142777
Up 9119 0 0 0 4 8 0 0 0
height_acc_summary
(Intercept) height_accretion age_blood05 smoke drink icpc1 icpc2 icpc3 SEAsum_83_05 time_bt_98_05
Down 511 0 0 0 9 2 0 0 0 1
NotSig 134471 142777 142777 142777 142766 142765 142777 142777 142777 142776
Up 7795 0 0 0 2 10 0 0 0 0
muscle_acc_summary
(Intercept) muscle_accretion age_blood05 smoke drink icpc1 icpc2 icpc3 SEAsum_83_05 time_bt_98_05
Down 450 0 0 0 8 2 0 0 0 0
NotSig 134584 142777 142777 142777 142768 142765 142777 142777 142777 142777
Up 7743 0 0 0 1 10 0 0 0 0
arm_acc_summary
(Intercept) arm_accretion age_blood05 smoke drink icpc1 icpc2 icpc3 SEAsum_83_05 time_bt_98_05
Down 472 0 0 0 7 2 0 0 0 0
NotSig 134016 142777 142777 142777 142769 142766 142777 142777 142777 142777
Up 8289 0 0 0 1 9 0 0 0 0

Load Annotation

annotation <- read.csv(here::here("/Data/DNAm", "annotation_all.csv"), header = TRUE, 
    nrows = 5e+05)

names(annotation)[1] <- "probe"

Annotation for blood T

blood_t_annot <- merge_annot(blood_t_toptable, annotation, pval = 0.1)
## Warning: Column `probe` joining character vector and factor, coercing into
## character vector

Check out relationships

dnam_t <- peep_dnam_pheno(top_annotation_file = blood_t_annot, pheno_file = testost)


dnam_t %>% ggplot(., aes(x = log_blood_t, y = value, group = probe, color = probe)) + 
    geom_point(alpha = 0.3) + stat_smooth(geom = "line", alpha = 0.5) + stat_smooth(method = "lm", 
    color = "gray60", alpha = 0.2) + ggpubr::theme_pubr() + theme(legend.position = "none") + 
    facet_wrap(~probe)
## `geom_smooth()` using method = 'loess' and formula 'y ~ x'
## Warning: Removed 18 rows containing non-finite values (stat_smooth).
## `geom_smooth()` using formula 'y ~ x'
## Warning: Removed 18 rows containing non-finite values (stat_smooth).
## Warning: Removed 18 rows containing missing values (geom_point).

Manhattan for T relationships

blood_t_annot <- merge_annot(blood_t_toptable, annotation, pval = 1) %>% mutate(new_chr = as.numeric(CHR), 
    sig_no = if_else(adj.P.Val < 0.1, "sig", "no"))
## Warning: Column `probe` joining character vector and factor, coercing into
## character vector
qqman::qq(blood_t_annot$P.Value, main = "Q-Q plot of EWAS p-values for blood T (logged)", 
    col = "blue4", cex = 1.5, las = 1)

library(calibrate)  # Needed for textxy used in this function
## Warning: package 'calibrate' was built under R version 3.5.2
## Loading required package: MASS
## 
## Attaching package: 'MASS'
## The following object is masked _by_ '.GlobalEnv':
## 
##     select
## The following object is masked from 'package:dplyr':
## 
##     select
# This function is based on qqman packages function - I wanted to change the
# colors of the points and insert my gene names (not probe names).
CPR_manhattan(blood_t_annot, chr = "new_chr", bp = "MAPINFO", p = "P.Value", snp = "probe", 
    chrlabs = c(1:22, "X", "Y"), highlight = blood_t_annot %>% filter(sig_no == "sig") %>% 
        pull(probe), genomewideline = -log10(1.2e-05), suggestiveline = FALSE, annotatePval = 1.207018e-05, 
    annotateTop = FALSE, gene = "Closest_TSS_gene_name")

Annotation for numbsex and numbpreg

numbsex_annot <- merge_annot(numbsex_toptable, annotation, pval = 0.1)
## Warning: Column `probe` joining character vector and factor, coercing into
## character vector
new_numbpreg_annot <- merge_annot(new_numbpreg_toptable, annotation, pval = 0.1)
## Warning: Column `probe` joining character vector and factor, coercing into
## character vector
dnam_numbsex <- peep_dnam_pheno(top_annotation_file = numbsex_annot, pheno_file = repro)
## Warning: Column `uncchdid` has different attributes on LHS and RHS of join
dnam_new_numbpreg <- peep_dnam_pheno(top_annotation_file = new_numbpreg_annot, pheno_file = repro)
## Warning: Column `uncchdid` has different attributes on LHS and RHS of join
# dnam_numbsex %>% ggplot(., aes(x = log(numbsex) , y = value, color = probe))+
# geom_point(alpha = 0.3)+ stat_smooth(geom = 'line', alpha = 0.5)+
# stat_smooth(method = 'lm', color = 'gray60', alpha = 0.2)+
# ggpubr::theme_pubr()+ theme(legend.position = 'none')+ facet_wrap(~probe)


dnam_new_numbpreg %>% ggplot(., aes(x = new_numbpreg, y = value, group = probe, color = probe)) + 
    geom_point(alpha = 0.3) + stat_smooth(geom = "line", alpha = 0.5) + stat_smooth(method = "lm", 
    color = "gray60", alpha = 0.2) + ggpubr::theme_pubr() + theme(legend.position = "none") + 
    facet_wrap(~probe)
## Don't know how to automatically pick scale for object of type haven_labelled. Defaulting to continuous.
## `geom_smooth()` using method = 'loess' and formula 'y ~ x'
## Warning: Removed 8 rows containing non-finite values (stat_smooth).
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : at -0.015
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : radius 0.000225
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : all data on boundary of neighborhood. make span bigger
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : pseudoinverse used at -0.015
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : neighborhood radius 0.015
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : reciprocal condition number 1
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : zero-width neighborhood. make span bigger
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : There are other near singularities as well. 1
## Warning: Computation failed in `stat_smooth()`:
## NA/NaN/Inf in foreign function call (arg 5)
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : at -0.015
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : radius 0.000225
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : all data on boundary of neighborhood. make span bigger
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : pseudoinverse used at -0.015
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : neighborhood radius 0.015
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : reciprocal condition number 1
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : zero-width neighborhood. make span bigger
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : There are other near singularities as well. 1
## Warning: Computation failed in `stat_smooth()`:
## NA/NaN/Inf in foreign function call (arg 5)
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : at -0.015
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : radius 0.000225
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : all data on boundary of neighborhood. make span bigger
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : pseudoinverse used at -0.015
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : neighborhood radius 0.015
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : reciprocal condition number 1
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : zero-width neighborhood. make span bigger
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : There are other near singularities as well. 1
## Warning: Computation failed in `stat_smooth()`:
## NA/NaN/Inf in foreign function call (arg 5)
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : at -0.015
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : radius 0.000225
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : all data on boundary of neighborhood. make span bigger
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : pseudoinverse used at -0.015
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : neighborhood radius 0.015
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : reciprocal condition number 1
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : zero-width neighborhood. make span bigger
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : There are other near singularities as well. 1
## Warning: Computation failed in `stat_smooth()`:
## NA/NaN/Inf in foreign function call (arg 5)
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : at -0.015
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : radius 0.000225
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : all data on boundary of neighborhood. make span bigger
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : pseudoinverse used at -0.015
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : neighborhood radius 0.015
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : reciprocal condition number 1
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : zero-width neighborhood. make span bigger
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : There are other near singularities as well. 1
## Warning: Computation failed in `stat_smooth()`:
## NA/NaN/Inf in foreign function call (arg 5)
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : at -0.015
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : radius 0.000225
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : all data on boundary of neighborhood. make span bigger
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : pseudoinverse used at -0.015
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : neighborhood radius 0.015
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : reciprocal condition number 1
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : zero-width neighborhood. make span bigger
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : There are other near singularities as well. 1
## Warning: Computation failed in `stat_smooth()`:
## NA/NaN/Inf in foreign function call (arg 5)
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : at -0.015
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : radius 0.000225
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : all data on boundary of neighborhood. make span bigger
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : pseudoinverse used at -0.015
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : neighborhood radius 0.015
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : reciprocal condition number 1
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : zero-width neighborhood. make span bigger
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : There are other near singularities as well. 1
## Warning: Computation failed in `stat_smooth()`:
## NA/NaN/Inf in foreign function call (arg 5)
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : at -0.015
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : radius 0.000225
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : all data on boundary of neighborhood. make span bigger
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : pseudoinverse used at -0.015
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : neighborhood radius 0.015
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : reciprocal condition number 1
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : zero-width neighborhood. make span bigger
## Warning in simpleLoess(y, x, w, span, degree = degree, parametric =
## parametric, : There are other near singularities as well. 1
## Warning: Computation failed in `stat_smooth()`:
## NA/NaN/Inf in foreign function call (arg 5)
## `geom_smooth()` using formula 'y ~ x'
## Warning: Removed 8 rows containing non-finite values (stat_smooth).
## Warning: Removed 8 rows containing missing values (geom_point).

Manhattan for numbsex relationships

numbsex_annot <- merge_annot(numbsex_toptable, annotation, pval = 1) %>% mutate(new_chr = as.numeric(CHR), 
    sig_no = if_else(adj.P.Val < 0.1, "sig", "no"))
## Warning: Column `probe` joining character vector and factor, coercing into
## character vector
qqman::qq(numbsex_annot$P.Value, main = "Q-Q plot of EWAS p-values for numbsex", 
    col = "blue4", cex = 1.5, las = 1)

library(calibrate)  # Needed for textxy used in this function

# This function is based on qqman packages function - I wanted to change the
# colors of the points and insert my gene names (not probe names).
CPR_manhattan(numbsex_annot, chr = "new_chr", bp = "MAPINFO", p = "P.Value", snp = "probe", 
    chrlabs = c(1:22, "X", "Y"), highlight = numbsex_annot %>% filter(sig_no == "sig") %>% 
        pull(probe), genomewideline = -log10(1.2e-05), suggestiveline = FALSE, annotatePval = 1.207018e-05, 
    annotateTop = FALSE, gene = "Closest_TSS_gene_name")

new_numbpreg_annot <- merge_annot(new_numbpreg_toptable, annotation, pval = 1) %>% 
    mutate(new_chr = as.numeric(CHR), sig_no = if_else(adj.P.Val < 0.1, "sig", "no"))
## Warning: Column `probe` joining character vector and factor, coercing into
## character vector
library(calibrate)  # Needed for textxy used in this function

# This function is based on qqman packages function - I wanted to change the
# colors of the points and insert my gene names (not probe names).
CPR_manhattan(new_numbpreg_annot, chr = "new_chr", bp = "MAPINFO", p = "P.Value", 
    snp = "probe", chrlabs = c(1:22, "X", "Y"), highlight = new_numbpreg_annot %>% 
        filter(sig_no == "sig") %>% pull(probe), genomewideline = -log10(5.14e-06), 
    suggestiveline = FALSE, annotatePval = 5.150634e-06, annotateTop = FALSE, gene = "Closest_TSS_gene_name")

All variables sites

Five percent probes for men and women: 143,052 rows

names_var_probes <- read_csv(here::here("Data/DNAm", "names_var_probes_m_and_f_xyincl.csv"))
## Parsed with column specification:
## cols(
##   probe = col_character()
## )

EWAS

T Phenotype EWAS

source(here::here("/Code/EWAS", "t_phenotype_ewas.R"))
## Parsed with column specification:
## cols(
##   uncchdid_w_DNAm = col_character()
## )
## Warning: Missing column names filled in: 'X1' [1]
## Parsed with column specification:
## cols(
##   X1 = col_double(),
##   uncchdid = col_double(),
##   icsex = col_character(),
##   dayblood = col_double(),
##   monthblood = col_double(),
##   yearblood = col_double(),
##   blood.draw.date = col_date(format = "")
## )
## Warning: Column `uncchdid` has different attributes on LHS and RHS of join
## Warning: Column `uncchdid` has different attributes on LHS and RHS of join
## Parsed with column specification:
## cols(
##   uncchdid = col_double(),
##   basebrgy = col_double(),
##   basewman = col_double(),
##   ic_dob = col_date(format = ""),
##   smoke = col_double(),
##   drink = col_double(),
##   age_blood05 = col_double(),
##   icpc1 = col_double(),
##   icpc2 = col_double(),
##   icpc3 = col_double(),
##   icpc4 = col_double(),
##   icpc5 = col_double(),
##   icpc6 = col_double(),
##   icpc7 = col_double(),
##   icpc8 = col_double(),
##   icpc9 = col_double(),
##   icpc10 = col_double(),
##   bmi = col_double(),
##   SEAsum_83_05 = col_double()
## )
amt_summary
(Intercept) amt05 age_saliva smoke drink amtime05 icpc1 icpc2 icpc3 bmi SEAsum_83_05
Down 421 0 0 0 8 2 2 1 0 1 0
NotSig 136970 143052 143052 143052 143041 143049 143044 143051 143052 143050 143052
Up 5661 0 0 0 3 1 6 0 0 1 0
pmt_summary
(Intercept) pmt05 age_saliva smoke drink pmtime05 icpc1 icpc2 icpc3 bmi SEAsum_83_05
Down 501 0 0 0 9 0 2 0 0 0 0
NotSig 134931 143052 143052 143052 143038 143052 143044 143052 143052 143052 143052
Up 7620 0 0 0 5 0 6 0 0 0 0
father_summary
(Intercept) fath05c age_blood05 smoke drink icpc1 icpc2 icpc3 bmi SEAsum_83_05
Down 509 0 0 0 8 2 0 0 0 0
NotSig 134918 143052 143052 143052 143040 143046 143052 143052 143052 143051
Up 7625 0 0 0 4 4 0 0 0 1
hhkids_summary
(Intercept) hholdkids05 smoke drink age_blood05 icpc1 icpc2 icpc3 bmi SEAsum_83_05
Down 526 0 0 8 0 2 0 0 0 0
NotSig 134682 143052 143052 143040 143052 143046 143052 143052 143052 143051
Up 7844 0 0 4 0 4 0 0 0 1
icpcfat_summary
(Intercept) icpcfat05 age_blood05 smoke drink icpc1 icpc2 icpc3 bmi SEAsum_83_05
Down 483 0 0 0 10 1 0 0 1 0
NotSig 134316 143050 143052 143052 143038 143046 143052 143052 143051 143052
Up 8253 2 0 0 4 5 0 0 0 0
rgrip_summary
(Intercept) rightgrip_mean age_blood05 smoke drink icpc1 icpc2 icpc3 bmi SEAsum_83_05
Down 536 0 0 0 7 2 0 0 0 0
NotSig 134843 143052 143052 143052 143041 143041 143052 143052 143052 143051
Up 7673 0 0 0 4 9 0 0 0 1
blood_t_summary
(Intercept) log_blood_t age_blood05 smoke drink icpc1 icpc2 icpc3 bmi SEAsum_83_05
Down 540 14 0 0 8 2 0 0 0 0
NotSig 135072 143021 143052 143052 143040 143044 143052 143052 143052 143051
Up 7440 17 0 0 4 6 0 0 0 1

Reproductive Effort EWAS

source(here::here("/Code/EWAS", "repro_phenotype_ewas.R"))
## Parsed with column specification:
## cols(
##   uncchdid_w_DNAm = col_character()
## )
## Warning: Missing column names filled in: 'X1' [1]
## Parsed with column specification:
## cols(
##   X1 = col_double(),
##   uncchdid = col_double(),
##   icsex = col_character(),
##   dayblood = col_double(),
##   monthblood = col_double(),
##   yearblood = col_double(),
##   blood.draw.date = col_date(format = "")
## )
## Parsed with column specification:
## cols(
##   uncchdid = col_double(),
##   basebrgy = col_double(),
##   basewman = col_double(),
##   ic_dob = col_date(format = ""),
##   smoke = col_double(),
##   drink = col_double(),
##   age_blood05 = col_double(),
##   icpc1 = col_double(),
##   icpc2 = col_double(),
##   icpc3 = col_double(),
##   icpc4 = col_double(),
##   icpc5 = col_double(),
##   icpc6 = col_double(),
##   icpc7 = col_double(),
##   icpc8 = col_double(),
##   icpc9 = col_double(),
##   icpc10 = col_double(),
##   bmi = col_double(),
##   SEAsum_83_05 = col_double()
## )
romantic_summary
(Intercept) romantic age_blood05 smoke drink icpc1 icpc2 icpc3 bmi SEAsum_83_05
Down 708 0 0 0 7 2 0 0 0 0
NotSig 132481 143052 143052 143052 143042 143041 143052 143052 143052 143049
Up 9863 0 0 0 3 9 0 0 0 3
sexinter_summary
(Intercept) sexinter age_blood05 smoke drink icpc1 icpc2 icpc3 bmi SEAsum_83_05
Down 671 0 0 0 17 2 0 0 0 0
NotSig 132732 143052 143052 143052 143029 143042 143052 143052 143052 143051
Up 9649 0 0 0 6 8 0 0 0 1
presrela_summary
(Intercept) presrela age_blood05 smoke drink icpc1 icpc2 icpc3 bmi SEAsum_83_05
Down 712 0 0 0 8 2 1 0 0 0
NotSig 132407 143052 143052 143052 143039 143042 143051 143052 143052 143051
Up 9933 0 0 0 5 8 0 0 0 1
numbsex_summary
(Intercept) log(numbsex + 1) age_blood05 smoke drink icpc1 icpc2 icpc3 bmi SEAsum_83_05
Down 678 0 0 0 14 1 0 0 0 0
NotSig 133216 143052 143052 143052 143033 143045 143052 143052 143052 143051
Up 9158 0 0 0 5 6 0 0 0 1
new_numbpreg_summary
(Intercept) new_numbpreg age_blood05 smoke drink icpc1 icpc2 icpc3 bmi SEAsum_83_05
Down 704 1 0 0 12 2 0 0 0 0
NotSig 132454 143044 143052 143052 143033 143045 143052 143052 143052 143050
Up 9894 7 0 0 7 5 0 0 0 2

Anthropometric EWAS

source(here::here("/Code/EWAS", "anthro_phenotype_ewas.R"))
## Parsed with column specification:
## cols(
##   uncchdid_w_DNAm = col_character()
## )
## Warning: Missing column names filled in: 'X1' [1]
## Parsed with column specification:
## cols(
##   X1 = col_double(),
##   uncchdid = col_double(),
##   icsex = col_character(),
##   dayblood = col_double(),
##   monthblood = col_double(),
##   yearblood = col_double(),
##   blood.draw.date = col_date(format = "")
## )
## Warning: Column `uncchdid` has different attributes on LHS and RHS of join
## Parsed with column specification:
## cols(
##   uncchdid_w_DNAm = col_character()
## )
## Warning: Missing column names filled in: 'X1' [1]
## Parsed with column specification:
## cols(
##   X1 = col_double(),
##   uncchdid = col_double(),
##   icsex = col_character(),
##   dayblood = col_double(),
##   monthblood = col_double(),
##   yearblood = col_double(),
##   blood.draw.date = col_date(format = "")
## )
## Warning: Column `uncchdid` has different attributes on LHS and RHS of join
## Warning: attributes are not identical across measure variables;
## they will be dropped
## Parsed with column specification:
## cols(
##   uncchdid = col_double(),
##   basebrgy = col_double(),
##   basewman = col_double(),
##   ic_dob = col_date(format = ""),
##   smoke = col_double(),
##   drink = col_double(),
##   age_blood05 = col_double(),
##   icpc1 = col_double(),
##   icpc2 = col_double(),
##   icpc3 = col_double(),
##   icpc4 = col_double(),
##   icpc5 = col_double(),
##   icpc6 = col_double(),
##   icpc7 = col_double(),
##   icpc8 = col_double(),
##   icpc9 = col_double(),
##   icpc10 = col_double(),
##   bmi = col_double(),
##   SEAsum_83_05 = col_double()
## )
## Warning: Column `uncchdid` has different attributes on LHS and RHS of join
height_summary
(Intercept) height age_blood05 smoke drink icpc1 icpc2 icpc3 SEAsum_83_05
Down 550 0 0 0 9 2 0 0 0
NotSig 135524 143052 143052 143052 143037 143042 143052 143052 143052
Up 6978 0 0 0 6 8 0 0 0
bmi_summary
(Intercept) bmi age_blood05 smoke drink icpc1 icpc2 icpc3 SEAsum_83_05
Down 696 0 0 0 8 2 0 0 0
NotSig 132393 143052 143052 143052 143039 143042 143052 143052 143051
Up 9963 0 0 0 5 8 0 0 1
arm_musc_area_summary
(Intercept) arm_musc_area age_blood05 smoke drink icpc1 icpc2 icpc3 SEAsum_83_05
Down 702 0 0 0 11 2 0 0 0
NotSig 132105 143052 143052 143052 143036 143042 143052 143052 143051
Up 10245 0 0 0 5 8 0 0 1
fatfree_mass_summary
(Intercept) fatfree_mass age_blood05 smoke drink icpc1 icpc2 icpc3 SEAsum_83_05
Down 637 0 0 0 9 2 0 0 0
NotSig 132166 143052 143052 143052 143038 143042 143052 143052 143052
Up 10249 0 0 0 5 8 0 0 0
bfperc_summary
(Intercept) bfperc age_blood05 smoke drink icpc1 icpc2 icpc3 SEAsum_83_05
Down 572 0 0 0 9 2 0 0 0
NotSig 133089 143052 143052 143052 143038 143042 143052 143052 143052
Up 9391 0 0 0 5 8 0 0 0
height_acc_summary
(Intercept) height_accretion age_blood05 smoke drink icpc1 icpc2 icpc3 SEAsum_83_05 time_bt_98_05
Down 523 0 0 0 9 2 0 0 0 1
NotSig 134481 143052 143052 143052 143040 143040 143052 143052 143052 143051
Up 8048 0 0 0 3 10 0 0 0 0
muscle_acc_summary
(Intercept) muscle_accretion age_blood05 smoke drink icpc1 icpc2 icpc3 SEAsum_83_05 time_bt_98_05
Down 471 0 0 0 8 2 0 0 0 0
NotSig 134759 143052 143052 143052 143042 143040 143052 143052 143052 143052
Up 7822 0 0 0 2 10 0 0 0 0
arm_acc_summary
(Intercept) arm_accretion age_blood05 smoke drink icpc1 icpc2 icpc3 SEAsum_83_05 time_bt_98_05
Down 491 0 0 0 7 2 0 0 0 0
NotSig 134228 143052 143052 143052 143042 143041 143052 143052 143052 143052
Up 8333 0 0 0 3 9 0 0 0 0

SEX VARIANT sites

Load all probes (just use mvals rownames)

sex_probes <- read_csv(here::here("Data/DNAm", "sex_probes.csv"))
## Parsed with column specification:
## cols(
##   probe = col_character()
## )
names_var_probes <- sex_probes

EWAS

T Phenotype EWAS

source(here::here("/Code/EWAS", "t_phenotype_ewas.R"))
## Parsed with column specification:
## cols(
##   uncchdid_w_DNAm = col_character()
## )
## Warning: Missing column names filled in: 'X1' [1]
## Parsed with column specification:
## cols(
##   X1 = col_double(),
##   uncchdid = col_double(),
##   icsex = col_character(),
##   dayblood = col_double(),
##   monthblood = col_double(),
##   yearblood = col_double(),
##   blood.draw.date = col_date(format = "")
## )
## Warning: Column `uncchdid` has different attributes on LHS and RHS of join
## Warning: Column `uncchdid` has different attributes on LHS and RHS of join
## Parsed with column specification:
## cols(
##   uncchdid = col_double(),
##   basebrgy = col_double(),
##   basewman = col_double(),
##   ic_dob = col_date(format = ""),
##   smoke = col_double(),
##   drink = col_double(),
##   age_blood05 = col_double(),
##   icpc1 = col_double(),
##   icpc2 = col_double(),
##   icpc3 = col_double(),
##   icpc4 = col_double(),
##   icpc5 = col_double(),
##   icpc6 = col_double(),
##   icpc7 = col_double(),
##   icpc8 = col_double(),
##   icpc9 = col_double(),
##   icpc10 = col_double(),
##   bmi = col_double(),
##   SEAsum_83_05 = col_double()
## )
amt_summary
(Intercept) amt05 age_saliva smoke drink amtime05 icpc1 icpc2 icpc3 bmi SEAsum_83_05
Down 20 0 0 0 0 0 0 0 0 0 0
NotSig 36697 37068 37068 37068 37067 37068 37068 37068 37068 37068 37068
Up 351 0 0 0 1 0 0 0 0 0 0
pmt_summary
(Intercept) pmt05 age_saliva smoke drink pmtime05 icpc1 icpc2 icpc3 bmi SEAsum_83_05
Down 25 0 0 0 0 0 0 0 0 0 0
NotSig 36441 37068 37068 37068 37067 37068 37068 37068 37068 37068 37068
Up 602 0 0 0 1 0 0 0 0 0 0
father_summary
(Intercept) fath05c age_blood05 smoke drink icpc1 icpc2 icpc3 bmi SEAsum_83_05
Down 26 0 0 0 0 0 0 0 0 0
NotSig 36480 37068 37068 37068 37067 37068 37068 37068 37068 37068
Up 562 0 0 0 1 0 0 0 0 0
hhkids_summary
(Intercept) hholdkids05 smoke drink age_blood05 icpc1 icpc2 icpc3 bmi SEAsum_83_05
Down 28 0 0 0 0 0 0 0 0 0
NotSig 36437 37068 37068 37066 37068 37068 37068 37068 37068 37068
Up 603 0 0 2 0 0 0 0 0 0
icpcfat_summary
(Intercept) icpcfat05 age_blood05 smoke drink icpc1 icpc2 icpc3 bmi SEAsum_83_05
Down 22 0 1 0 0 0 0 0 0 0
NotSig 36437 37068 37067 37068 37066 37068 37068 37068 37068 37068
Up 609 0 0 0 2 0 0 0 0 0
rgrip_summary
(Intercept) rightgrip_mean age_blood05 smoke drink icpc1 icpc2 icpc3 bmi SEAsum_83_05
Down 25 0 0 0 0 0 0 0 0 0
NotSig 36474 37068 37068 37068 37067 37068 37068 37068 37068 37068
Up 569 0 0 0 1 0 0 0 0 0
blood_t_summary
(Intercept) log_blood_t age_blood05 smoke drink icpc1 icpc2 icpc3 bmi SEAsum_83_05
Down 32 1 0 0 0 0 0 0 0 0
NotSig 36368 37065 37068 37068 37066 37068 37068 37068 37068 37068
Up 668 2 0 0 2 0 0 0 0 0

Reproductive Effort EWAS

source(here::here("/Code/EWAS", "repro_phenotype_ewas.R"))
## Parsed with column specification:
## cols(
##   uncchdid_w_DNAm = col_character()
## )
## Warning: Missing column names filled in: 'X1' [1]
## Parsed with column specification:
## cols(
##   X1 = col_double(),
##   uncchdid = col_double(),
##   icsex = col_character(),
##   dayblood = col_double(),
##   monthblood = col_double(),
##   yearblood = col_double(),
##   blood.draw.date = col_date(format = "")
## )
## Parsed with column specification:
## cols(
##   uncchdid = col_double(),
##   basebrgy = col_double(),
##   basewman = col_double(),
##   ic_dob = col_date(format = ""),
##   smoke = col_double(),
##   drink = col_double(),
##   age_blood05 = col_double(),
##   icpc1 = col_double(),
##   icpc2 = col_double(),
##   icpc3 = col_double(),
##   icpc4 = col_double(),
##   icpc5 = col_double(),
##   icpc6 = col_double(),
##   icpc7 = col_double(),
##   icpc8 = col_double(),
##   icpc9 = col_double(),
##   icpc10 = col_double(),
##   bmi = col_double(),
##   SEAsum_83_05 = col_double()
## )
romantic_summary
(Intercept) romantic age_blood05 smoke drink icpc1 icpc2 icpc3 bmi SEAsum_83_05
Down 35 0 0 0 0 0 0 0 0 0
NotSig 36026 37068 37068 37068 37067 37068 37068 37068 37068 37067
Up 1007 0 0 0 1 0 0 0 0 1
sexinter_summary
(Intercept) sexinter age_blood05 smoke drink icpc1 icpc2 icpc3 bmi SEAsum_83_05
Down 35 0 0 0 1 0 0 0 0 0
NotSig 36090 37068 37068 37068 37065 37068 37068 37068 37068 37068
Up 943 0 0 0 2 0 0 0 0 0
presrela_summary
(Intercept) presrela age_blood05 smoke drink icpc1 icpc2 icpc3 bmi SEAsum_83_05
Down 36 0 0 0 0 0 0 0 0 0
NotSig 36021 37068 37068 37068 37067 37068 37068 37068 37068 37067
Up 1011 0 0 0 1 0 0 0 0 1
numbsex_summary
(Intercept) log(numbsex + 1) age_blood05 smoke drink icpc1 icpc2 icpc3 bmi SEAsum_83_05
Down 32 0 0 0 0 0 0 0 0 0
NotSig 36207 37068 37068 37068 37067 37068 37068 37068 37068 37068
Up 829 0 0 0 1 0 0 0 0 0
new_numbpreg_summary
(Intercept) new_numbpreg age_blood05 smoke drink icpc1 icpc2 icpc3 bmi SEAsum_83_05
Down 38 0 0 0 0 0 0 0 0 0
NotSig 36000 37066 37068 37068 37067 37068 37068 37068 37068 37067
Up 1030 2 0 0 1 0 0 0 0 1

Anthropometric EWAS

source(here::here("/Code/EWAS", "anthro_phenotype_ewas.R"))
## Parsed with column specification:
## cols(
##   uncchdid_w_DNAm = col_character()
## )
## Warning: Missing column names filled in: 'X1' [1]
## Parsed with column specification:
## cols(
##   X1 = col_double(),
##   uncchdid = col_double(),
##   icsex = col_character(),
##   dayblood = col_double(),
##   monthblood = col_double(),
##   yearblood = col_double(),
##   blood.draw.date = col_date(format = "")
## )
## Warning: Column `uncchdid` has different attributes on LHS and RHS of join
## Parsed with column specification:
## cols(
##   uncchdid_w_DNAm = col_character()
## )
## Warning: Missing column names filled in: 'X1' [1]
## Parsed with column specification:
## cols(
##   X1 = col_double(),
##   uncchdid = col_double(),
##   icsex = col_character(),
##   dayblood = col_double(),
##   monthblood = col_double(),
##   yearblood = col_double(),
##   blood.draw.date = col_date(format = "")
## )
## Warning: Column `uncchdid` has different attributes on LHS and RHS of join
## Warning: attributes are not identical across measure variables;
## they will be dropped
## Parsed with column specification:
## cols(
##   uncchdid = col_double(),
##   basebrgy = col_double(),
##   basewman = col_double(),
##   ic_dob = col_date(format = ""),
##   smoke = col_double(),
##   drink = col_double(),
##   age_blood05 = col_double(),
##   icpc1 = col_double(),
##   icpc2 = col_double(),
##   icpc3 = col_double(),
##   icpc4 = col_double(),
##   icpc5 = col_double(),
##   icpc6 = col_double(),
##   icpc7 = col_double(),
##   icpc8 = col_double(),
##   icpc9 = col_double(),
##   icpc10 = col_double(),
##   bmi = col_double(),
##   SEAsum_83_05 = col_double()
## )
## Warning: Column `uncchdid` has different attributes on LHS and RHS of join
height_summary
(Intercept) height age_blood05 smoke drink icpc1 icpc2 icpc3 SEAsum_83_05
Down 13 0 0 0 0 0 0 0 0
NotSig 36656 37068 37068 37068 37067 37068 37068 37068 37068
Up 399 0 0 0 1 0 0 0 0
bmi_summary
(Intercept) bmi age_blood05 smoke drink icpc1 icpc2 icpc3 SEAsum_83_05
Down 35 0 0 0 0 0 0 0 0
NotSig 35993 37068 37068 37068 37067 37068 37068 37068 37067
Up 1040 0 0 0 1 0 0 0 1
arm_musc_area_summary
(Intercept) arm_musc_area age_blood05 smoke drink icpc1 icpc2 icpc3 SEAsum_83_05
Down 38 0 0 0 0 0 0 0 0
NotSig 36064 37068 37068 37068 37066 37068 37068 37068 37068
Up 966 0 0 0 2 0 0 0 0
fatfree_mass_summary
(Intercept) fatfree_mass age_blood05 smoke drink icpc1 icpc2 icpc3 SEAsum_83_05
Down 41 0 0 0 0 0 0 0 0
NotSig 36068 37068 37068 37068 37067 37068 37068 37068 37068
Up 959 0 0 0 1 0 0 0 0
bfperc_summary
(Intercept) bfperc age_blood05 smoke drink icpc1 icpc2 icpc3 SEAsum_83_05
Down 39 0 0 0 0 0 0 0 0
NotSig 36125 37068 37068 37068 37067 37068 37068 37068 37068
Up 904 0 0 0 1 0 0 0 0
height_acc_summary
(Intercept) height_accretion age_blood05 smoke drink icpc1 icpc2 icpc3 SEAsum_83_05 time_bt_98_05
Down 27 0 0 0 0 0 0 0 0 0
NotSig 36449 37067 37068 37068 37067 37068 37068 37068 37068 37068
Up 592 1 0 0 1 0 0 0 0 0
muscle_acc_summary
(Intercept) muscle_accretion age_blood05 smoke drink icpc1 icpc2 icpc3 SEAsum_83_05 time_bt_98_05
Down 24 0 0 0 0 0 0 0 0 0
NotSig 36431 37068 37068 37068 37067 37066 37068 37068 37068 37068
Up 613 0 0 0 1 2 0 0 0 0
arm_acc_summary
(Intercept) arm_accretion age_blood05 smoke drink icpc1 icpc2 icpc3 SEAsum_83_05 time_bt_98_05
Down 27 0 0 0 0 0 0 0 0 0
NotSig 36324 37068 37068 37068 37067 37068 37068 37068 37068 37068
Up 717 0 0 0 1 0 0 0 0 0

All sites

Load all probes (just use mvals rownames)

names_var_probes <- rownames(mvals) %>% data_frame() %>% rename(probe = ".")
## Warning: `data_frame()` is deprecated, use `tibble()`.
## This warning is displayed once per session.

EWAS

T Phenotype EWAS

source(here::here("/Code/EWAS", "t_phenotype_ewas.R"))
## Parsed with column specification:
## cols(
##   uncchdid_w_DNAm = col_character()
## )
## Warning: Missing column names filled in: 'X1' [1]
## Parsed with column specification:
## cols(
##   X1 = col_double(),
##   uncchdid = col_double(),
##   icsex = col_character(),
##   dayblood = col_double(),
##   monthblood = col_double(),
##   yearblood = col_double(),
##   blood.draw.date = col_date(format = "")
## )
## Warning: Column `uncchdid` has different attributes on LHS and RHS of join
## Warning: Column `uncchdid` has different attributes on LHS and RHS of join
## Parsed with column specification:
## cols(
##   uncchdid = col_double(),
##   basebrgy = col_double(),
##   basewman = col_double(),
##   ic_dob = col_date(format = ""),
##   smoke = col_double(),
##   drink = col_double(),
##   age_blood05 = col_double(),
##   icpc1 = col_double(),
##   icpc2 = col_double(),
##   icpc3 = col_double(),
##   icpc4 = col_double(),
##   icpc5 = col_double(),
##   icpc6 = col_double(),
##   icpc7 = col_double(),
##   icpc8 = col_double(),
##   icpc9 = col_double(),
##   icpc10 = col_double(),
##   bmi = col_double(),
##   SEAsum_83_05 = col_double()
## )
amt_summary
(Intercept) amt05 age_saliva smoke drink amtime05 icpc1 icpc2 icpc3 bmi SEAsum_83_05
Down 47669 0 0 0 10 0 2 0 0 0 0
NotSig 305808 444810 444810 444810 444789 444810 444799 444810 444810 444810 444810
Up 91333 0 0 0 11 0 9 0 0 0 0
pmt_summary
(Intercept) pmt05 age_saliva smoke drink pmtime05 icpc1 icpc2 icpc3 bmi SEAsum_83_05
Down 42636 0 0 0 17 0 1 0 0 0 0
NotSig 307362 444810 444810 444810 444778 444810 444805 444810 444810 444810 444810
Up 94812 0 0 0 15 0 4 0 0 0 0
father_summary
(Intercept) fath05c age_blood05 smoke drink icpc1 icpc2 icpc3 bmi SEAsum_83_05
Down 44677 1 0 0 13 1 0 0 0 0
NotSig 304617 444809 444810 444810 444786 444806 444810 444810 444810 444810
Up 95516 0 0 0 11 3 0 0 0 0
hhkids_summary
(Intercept) hholdkids05 smoke drink age_blood05 icpc1 icpc2 icpc3 bmi SEAsum_83_05
Down 44747 1 0 12 0 1 0 0 0 0
NotSig 304175 444809 444810 444786 444810 444806 444810 444810 444810 444810
Up 95888 0 0 12 0 3 0 0 0 0
icpcfat_summary
(Intercept) icpcfat05 age_blood05 smoke drink icpc1 icpc2 icpc3 bmi SEAsum_83_05
Down 42525 0 0 0 9 0 0 0 0 0
NotSig 306060 444810 444810 444810 444789 444808 444810 444810 444810 444810
Up 96225 0 0 0 12 2 0 0 0 0
rgrip_summary
(Intercept) rightgrip_mean age_blood05 smoke drink icpc1 icpc2 icpc3 bmi SEAsum_83_05
Down 44626 0 0 0 7 1 0 0 0 0
NotSig 305747 444810 444810 444810 444792 444804 444810 444810 444810 444810
Up 94437 0 0 0 11 5 0 0 0 0
blood_t_summary
(Intercept) log_blood_t age_blood05 smoke drink icpc1 icpc2 icpc3 bmi SEAsum_83_05
Down 41700 48 0 0 10 1 0 0 0 0
NotSig 318457 444711 444810 444810 444788 444803 444810 444810 444810 444809
Up 84653 51 0 0 12 6 0 0 0 1

zero.one cutoff - Manhattan for T relationships

blood_t_annot <- merge_annot(blood_t_toptable, annotation, pval = 1) %>% mutate(new_chr = as.numeric(CHR), 
    sig_no = if_else(adj.P.Val < 0.1, "sig", "no"))
## Warning: Column `probe` joining character vector and factor, coercing into
## character vector
qqman::qq(blood_t_annot$P.Value, main = "Q-Q plot of EWAS p-values for blood T (logged)", 
    col = "blue4", cex = 1.5, las = 1)

library(calibrate)  # Needed for textxy used in this function

# This function is based on qqman packages function - I wanted to change the
# colors of the points and insert my gene names (not probe names).
CPR_manhattan(blood_t_annot, chr = "new_chr", bp = "MAPINFO", p = "P.Value", snp = "probe", 
    chrlabs = c(1:22, "X", "Y"), highlight = blood_t_annot %>% filter(sig_no == "sig") %>% 
        pull(probe), genomewideline = -log10(1.2e-05), suggestiveline = FALSE, annotatePval = 1.207018e-05, 
    annotateTop = FALSE, gene = "Closest_TSS_gene_name")

zero.zerofive cutoff Manhattan

blood_t_annot <- merge_annot(blood_t_toptable, annotation, pval = 1) %>% mutate(new_chr = as.numeric(CHR), 
    sig_no = if_else(adj.P.Val < 0.05, "sig", "no"))
## Warning: Column `probe` joining character vector and factor, coercing into
## character vector
qqman::qq(blood_t_annot$P.Value, main = "Q-Q plot of EWAS p-values for blood T (logged)", 
    col = "blue4", cex = 1.5, las = 1)

library(calibrate)  # Needed for textxy used in this function

# This function is based on qqman packages function - I wanted to change the
# colors of the points and insert my gene names (not probe names).
CPR_manhattan(blood_t_annot, chr = "new_chr", bp = "MAPINFO", p = "P.Value", snp = "probe", 
    chrlabs = c(1:22, "X", "Y"), highlight = blood_t_annot %>% filter(sig_no == "sig") %>% 
        pull(probe), genomewideline = -log10(1.2e-05), suggestiveline = FALSE, annotatePval = 1.207018e-05, 
    annotateTop = FALSE, gene = "Closest_TSS_gene_name")

## Reproductive Effort EWAS
source(here::here("/Code/EWAS", "repro_phenotype_ewas.R"))
## Parsed with column specification:
## cols(
##   uncchdid_w_DNAm = col_character()
## )
## Warning: Missing column names filled in: 'X1' [1]
## Parsed with column specification:
## cols(
##   X1 = col_double(),
##   uncchdid = col_double(),
##   icsex = col_character(),
##   dayblood = col_double(),
##   monthblood = col_double(),
##   yearblood = col_double(),
##   blood.draw.date = col_date(format = "")
## )
## Parsed with column specification:
## cols(
##   uncchdid = col_double(),
##   basebrgy = col_double(),
##   basewman = col_double(),
##   ic_dob = col_date(format = ""),
##   smoke = col_double(),
##   drink = col_double(),
##   age_blood05 = col_double(),
##   icpc1 = col_double(),
##   icpc2 = col_double(),
##   icpc3 = col_double(),
##   icpc4 = col_double(),
##   icpc5 = col_double(),
##   icpc6 = col_double(),
##   icpc7 = col_double(),
##   icpc8 = col_double(),
##   icpc9 = col_double(),
##   icpc10 = col_double(),
##   bmi = col_double(),
##   SEAsum_83_05 = col_double()
## )
romantic_summary
(Intercept) romantic age_blood05 smoke drink icpc1 icpc2 icpc3 bmi SEAsum_83_05
Down 53502 0 1 0 10 1 0 0 0 0
NotSig 279513 444810 444809 444810 444789 444802 444810 444810 444810 444809
Up 111795 0 0 0 11 7 0 0 0 1
sexinter_summary
(Intercept) sexinter age_blood05 smoke drink icpc1 icpc2 icpc3 bmi SEAsum_83_05
Down 52409 0 1 0 23 2 0 0 0 0
NotSig 281515 444810 444809 444810 444771 444801 444810 444810 444810 444810
Up 110886 0 0 0 16 7 0 0 0 0
presrela_summary
(Intercept) presrela age_blood05 smoke drink icpc1 icpc2 icpc3 bmi SEAsum_83_05
Down 53815 0 1 0 12 2 0 0 0 0
NotSig 278505 444810 444809 444810 444785 444803 444810 444810 444810 444810
Up 112490 0 0 0 13 5 0 0 0 0
numbsex_summary
(Intercept) log(numbsex + 1) age_blood05 smoke drink icpc1 icpc2 icpc3 bmi SEAsum_83_05
Down 53341 0 1 0 29 1 0 0 0 0
NotSig 282281 444810 444809 444810 444765 444804 444810 444810 444810 444810
Up 109188 0 0 0 16 5 0 0 0 0
new_numbpreg_summary
(Intercept) new_numbpreg age_blood05 smoke drink icpc1 icpc2 icpc3 bmi SEAsum_83_05
Down 53964 1 1 0 8 1 0 0 0 0
NotSig 278493 444803 444809 444810 444789 444805 444810 444810 444810 444809
Up 112353 6 0 0 13 4 0 0 0 1

Anthropometric EWAS

source(here::here("/Code/EWAS", "anthro_phenotype_ewas.R"))
## Parsed with column specification:
## cols(
##   uncchdid_w_DNAm = col_character()
## )
## Warning: Missing column names filled in: 'X1' [1]
## Parsed with column specification:
## cols(
##   X1 = col_double(),
##   uncchdid = col_double(),
##   icsex = col_character(),
##   dayblood = col_double(),
##   monthblood = col_double(),
##   yearblood = col_double(),
##   blood.draw.date = col_date(format = "")
## )
## Warning: Column `uncchdid` has different attributes on LHS and RHS of join
## Parsed with column specification:
## cols(
##   uncchdid_w_DNAm = col_character()
## )
## Warning: Missing column names filled in: 'X1' [1]
## Parsed with column specification:
## cols(
##   X1 = col_double(),
##   uncchdid = col_double(),
##   icsex = col_character(),
##   dayblood = col_double(),
##   monthblood = col_double(),
##   yearblood = col_double(),
##   blood.draw.date = col_date(format = "")
## )
## Warning: Column `uncchdid` has different attributes on LHS and RHS of join
## Warning: attributes are not identical across measure variables;
## they will be dropped
## Parsed with column specification:
## cols(
##   uncchdid = col_double(),
##   basebrgy = col_double(),
##   basewman = col_double(),
##   ic_dob = col_date(format = ""),
##   smoke = col_double(),
##   drink = col_double(),
##   age_blood05 = col_double(),
##   icpc1 = col_double(),
##   icpc2 = col_double(),
##   icpc3 = col_double(),
##   icpc4 = col_double(),
##   icpc5 = col_double(),
##   icpc6 = col_double(),
##   icpc7 = col_double(),
##   icpc8 = col_double(),
##   icpc9 = col_double(),
##   icpc10 = col_double(),
##   bmi = col_double(),
##   SEAsum_83_05 = col_double()
## )
## Warning: Column `uncchdid` has different attributes on LHS and RHS of join
height_summary
(Intercept) height age_blood05 smoke drink icpc1 icpc2 icpc3 SEAsum_83_05
Down 51639 0 1 0 12 2 0 0 0
NotSig 290978 444810 444809 444810 444786 444802 444810 444810 444810
Up 102193 0 0 0 12 6 0 0 0
bmi_summary
(Intercept) bmi age_blood05 smoke drink icpc1 icpc2 icpc3 SEAsum_83_05
Down 53446 0 1 0 16 2 0 0 0
NotSig 278764 444810 444809 444810 444778 444802 444810 444810 444810
Up 112600 0 0 0 16 6 0 0 0
arm_musc_area_summary
(Intercept) arm_musc_area age_blood05 smoke drink icpc1 icpc2 icpc3 SEAsum_83_05
Down 56209 0 1 0 19 2 0 0 0
NotSig 271364 444810 444809 444810 444774 444802 444810 444810 444810
Up 117237 0 0 0 17 6 0 0 0
fatfree_mass_summary
(Intercept) fatfree_mass age_blood05 smoke drink icpc1 icpc2 icpc3 SEAsum_83_05
Down 55208 0 1 0 16 2 0 0 0
NotSig 267539 444810 444809 444810 444779 444802 444810 444810 444810
Up 122063 0 0 0 15 6 0 0 0
bfperc_summary
(Intercept) bfperc age_blood05 smoke drink icpc1 icpc2 icpc3 SEAsum_83_05
Down 52017 0 1 0 16 2 0 0 0
NotSig 275480 444810 444809 444810 444778 444802 444810 444810 444810
Up 117313 0 0 0 16 6 0 0 0
height_acc_summary
(Intercept) height_accretion age_blood05 smoke drink icpc1 icpc2 icpc3 SEAsum_83_05 time_bt_98_05
Down 55705 0 0 0 19 1 0 0 0 0
NotSig 271025 444810 444810 444810 444779 444803 444810 444810 444810 444810
Up 118080 0 0 0 12 6 0 0 0 0
muscle_acc_summary
(Intercept) muscle_accretion age_blood05 smoke drink icpc1 icpc2 icpc3 SEAsum_83_05 time_bt_98_05
Down 51939 0 0 0 21 2 0 0 0 0
NotSig 278293 444810 444810 444810 444778 444802 444810 444810 444810 444810
Up 114578 0 0 0 11 6 0 0 0 0
arm_acc_summary
(Intercept) arm_accretion age_blood05 smoke drink icpc1 icpc2 icpc3 SEAsum_83_05 time_bt_98_05
Down 50686 0 0 0 16 1 0 0 0 0
NotSig 282111 444810 444810 444810 444783 444803 444810 444810 444810 444810
Up 112013 0 0 0 11 6 0 0 0 0